﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ueEngine.Biz.Inf.LogicEntity;

namespace ueEngine.Biz.Core.ExServer.WorkPool.WorkHandle.FullSearch
{
    public class PositionItem
    {
        /// <summary>
        /// 招募单Id
        /// </summary>
        public int RecuritId { get; set; }
        /// <summary>
        /// 职位Id
        /// </summary>
        public int PositionId { get; set; }
        public string Recuriter { get; set; }
        public string URL { get; set; }

        /// <summary>
        /// 招聘企业名称
        /// </summary>
        public string CompanyName { get; set; }
        /// <summary>
        /// 兼职标题
        /// </summary>
        public string Title { get; set; }
        public AreaCode WorkArea { get; set; }
        public string WorkAddress { get; set; }
        //public string RecuritDescript { get; set; }
        public string PositionDescript { get; set; }
        /// <summary>
        /// 职位类型
        /// </summary>
        public PositionType PositionType { get; set; }
        /// <summary>
        /// 职位名
        /// </summary>
        public string PositionName { get; set; }
        /// <summary>
        /// 职位级别 0:普通 1:加急
        /// </summary>
        public int Priority { get; set; }
        public int PositionLevel { get; set; }
        /// <summary>
        /// 招募源类型 对应招募单的RecruitType
        /// </summary>
        public RecruitSheetType RecruitSheetType { get; set; }
        public RecruitSheetSubject RecruitSheetSubject { get; set; }
        public DateTime PublishDate { get; set; }
        public CertificationLevel CertificationLevel { get; set; }
    }
    /// <summary>
    /// 创建索引所的类
    /// </summary>
    public class PositionCell
    {
        public PositionCell() { }
        public PositionCell(PositionItem item)
        {
            this.RecuritId = item.RecuritId;
            this.PositionId = item.PositionId;
            this.Url = item.URL;

            this.Recuriter = item.Recuriter;
            this.CompanyName = item.CompanyName;
            this.Title = item.Title;
            this.WorkArea = item.WorkArea.Mapping();
            this.WorkAddress = item.WorkAddress;
            //this.RecuritDescript = item.RecuritDescript;
            this.PositionDescript = item.PositionDescript;
            this.PositionType = (int)item.PositionType;
            this.PositionName = item.PositionName;
            this.Content = BuildContent();

            this.RecruitSheetType = (int)item.RecruitSheetType;
            this.RecruitSheetSubject = (int)item.RecruitSheetSubject;
            this.Priority = item.Priority;
            this.CertificationLevel = (int)item.CertificationLevel;
            this.PublishDate = item.PublishDate;
        }
        private string BuildContent()
        { 
            //区域，地址,公司名,兼职标题,职位名
            return String.Format("{0},{1},{2},{3},{4}",
                this.WorkArea, this.WorkAddress.Replace(this.WorkArea,""),this.CompanyName, this.Title, this.PositionName);
        }
        
        /// <summary>
        /// 招募单Id
        /// </summary>
        public int RecuritId { get; set; }
        /// <summary>
        /// 职位Id
        /// </summary>
        /// 
        public int PositionId { get; set; }
        ///// <summary>
        ///// 兼职类型 最新兼职招募 长期兼职招募
        ///// </summary>
        //public string RecuritType { get; set; }

        /// <summary>
        /// 链接
        /// </summary>
        public string Url
        {
            get;
            set;
        }
        public string Recuriter { get; set; }
        /// <summary>
        /// 工作区域
        /// </summary>
        public string WorkArea
        {
            get;
            set;
        }
        public string WorkAddress { get; set; }
        /// <summary>
        /// 招聘企业名称
        /// </summary>
        public string CompanyName { get; set; }
        /// <summary>
        /// 招募标题
        /// </summary>
        public string Title
        {
            get;
            set;
        }
        //public string RecuritDescript { get; set; }
        /// <summary>
        /// 职位描述
        /// </summary>
        public string PositionDescript
        {
            get;
            set;
        }
        /// <summary>
        /// 职位类型
        /// </summary>
        public int PositionType
        {
            get;
            set;
        }
        public string PositionName { get; set; }
        /// <summary>
        /// 索引全文
        /// </summary>
        internal string Content { get; set; }

        /// <summary>
        /// 认证级别 0:普通 1：认证 2：官方合作
        /// </summary>
        public int CertificationLevel { get; set; }
        /// <summary>
        /// 加急招聘
        /// 0:正常 1：加急
        /// </summary>
        public int Priority { get; set; }
        public int RecruitSheetType { get; set; }
        public int RecruitSheetSubject { get; set; }
        public DateTime PublishDate { get; set; }
        public string TitleHighLighter { get; set; }
        public string Abstract { get; set; }

       
    }
}
